package com.ziven.common.widget.value;

import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.StringRes;

import com.ziven.easygo.util.ViewHelper;

/**
 * @author Ziven
 */
public final class Title extends Value {

    public static Title stringId (@StringRes int stringId) {
        return new Title().accept(my -> my.resId = stringId);
    }

    public static Title title(String title) {
        return new Title().accept(my -> my.value = title);
    }

    private Title() {}

    @Override
    protected void takeEffect(@NonNull ViewHelper<? extends View> helper) {
        if(resId != 0) {
            helper.setText(resId);
        } else {
            value(String.class, helper::setText);
        }
    }
}
